package com.fmk.utils;

public final class StringUtils {
    public static interface Constants {
        String CRLF  = System.getProperty("line.separator");
        String EMPTY = "";
        String TAB   = "\t";
    }

    private StringUtils() {
    }

    /**
     * @param args
     */
    public static void main(final String[] args) {

    }

    public static boolean isEmpty(final Object object) {
        final boolean ingnoreWhiteSpace = true;
        final boolean isEmpty = StringUtils.isEmpty(object, ingnoreWhiteSpace);
        return isEmpty;
    }

    public static boolean isEmpty(final Object object, final boolean ingnoreWhiteSpace) {
        if (object == null) {
            return true;
        }
        final String string = ingnoreWhiteSpace ? object.toString().trim() : object.toString();
        if (Constants.EMPTY.equals(string)) {
            return true;
        }
        return false;
    }

    public static boolean isEmptyLine(final String line) {
        if (StringUtils.isEmpty(line)) {
            return true;
        }
        final String replaceAll = line.replaceAll(RegExpUtils.Constants.REGX_ESPACES, StringUtils.Constants.EMPTY);
        if (replaceAll != null && replaceAll.length() == 0) {
            return true;
        }
        return false;
    }
}
